<template>
  <div class="header">
    <div class="header-left">
        <div class="iconfont back-icon">&#xe624;</div>
    </div>
    <div class="header-input">
        <span class="iconfont">&#xe632;</span>
        输入城市/景点/游玩主题
    </div>
    <router-link to="/city">
      <div class="header-right">
      {{this.city}}
      <span class="iconfont arrow-icon">&#xe65a;</span>
      </div>
    </router-link>
  </div>
</template>

<script>
import { mapState, mapGetters } from 'vuex'
export default {
  name: 'HomeHeader',
  computed: {
    // mapState把vuex的数据city映射到这个组件的computed属性里
    ...mapState(['city']),
    ...mapGetters(['doubleCity'])
  }
}
</script>

<style lang="stylus" scoped>
  @import '~styles/varibles.styl'
  .header
    display: flex
    line-height: $headerHeight
    background: $bgColor
    color: #fff
    font-size: 14px
    .header-left
      width: 41px
      float: left
      .back-icon
        text-align: center
        font-size: 20px
    .header-input
      flex: 1
      height: 28px
      line-height: 28px
      margin-top: 6px
      background: #fff
      border-radius: 5px
      color: #ccc
      padding-left: 10px
    .header-right
      min-width: 60px
      padding: 0 4px
      float: right
      text-align: center
      color: #fff
      .arrow-icon
        font-size: 14px
</style>
